class Programer(object):

    def __init__(self, name, age):
        self.name = name
        if isinstance(age, int):
            self.age = age
        else:
            raise Exception('age must be int')

    def __eq__(self, other):
        if isinstance(other, Programer):
            if self.age == other.age:
                return True
            else:
                return False
        else:
            raise Exception('对象类型必须是Programer')

    def __add__(self, other):
        if isinstance(other, Programer):
            return self.age + other.age
        else:
            raise Exception('对象类型必须是Programer')


if __name__ == '__main__':
    programer1 = Programer("唐艳艳", 23);
    programer2 = Programer("徐宗萌", 24);
    print(programer1 == programer2)
    print(programer1 + programer2)